qui {
	local cnt=0
	forvalues truncation=$truncation_list {
		local cnt=`cnt'+1
	}
	capture program drop ccn_het_LL
	local count=0
	foreach lhs in $LHSlist { 
		local controls="${CONTROLlist_`lhs'}"
		local subsample = "$subsample"
		foreach rhs in $RHSlist { 
			foreach robust in $robust_list {
				forvalues K=$K_list {
					matrix actual_estimates_mat = J(`cnt',10,-9)
					local rowcounter = 0
					forvalues truncation=$truncation_list {
						noisily display "LHS=`lhs', RHS=`rhs', SE=`robust', K=`K', $S_DATE, $S_TIME, `truncation'"
						local rowcounter = `rowcounter'+1
						use "$datapath/003_cluster_`subsample'_`lhs'.dta", clear
						local control_length = 0
						foreach control of varlist `controls' {
							local control_length = `control_length' + 1
						}
						global control_length = `control_length'
						qui tab X_`K', generate(dumX_`K'_)
						gen A=afqt_mom
						
						qui ccn_het_LL symmetric `K' `rhs' `lhs' `robust' "`controls'" het_tobit `truncation'
						matrix actual_estimates_mat[`rowcounter',1] = r(BETA)
						matrix actual_estimates_mat[`rowcounter',2] = r(SE)		
						matrix actual_estimates_mat[`rowcounter',3] = r(BETA_A)
						matrix actual_estimates_mat[`rowcounter',4] = r(SE_A)		
						matrix actual_estimates_mat[`rowcounter',5] = r(BETA_L)
						matrix actual_estimates_mat[`rowcounter',6] = r(SE_L)		
						matrix actual_estimates_mat[`rowcounter',7] = r(BETA_AL)
						matrix actual_estimates_mat[`rowcounter',8] = r(SE_AL)		
						matrix actual_estimates_mat[`rowcounter',9] = r(ESAMP)	
						matrix actual_estimates_mat[`rowcounter',10] = `truncation'	
					}
					mat colnames actual_estimates_mat = b_HetSymm se_HetSymm bA_HetSymm seA_HetSymm bL_HetSymm seL_HetSymm ///
					bAL_HetSymm seAL_HetSymm Neff_HetSymm truncation
					clear

					qui svmat actual_estimates_mat, names(col)
					replace b_HetSymm=b_HetSymm*100
					replace se_HetSymm=se_HetSymm*100
					replace bA_HetSymm=bA_HetSymm*100
					replace seA_HetSymm=seA_HetSymm*100
					replace bL_HetSymm=bL_HetSymm*100
					replace seL_HetSymm=seL_HetSymm*100
					replace bAL_HetSymm=bAL_HetSymm*100
					replace seAL_HetSymm=seAL_HetSymm*100
					gen LHS="`lhs'"
					gen RHS="`rhs'"
					gen Kcluster=`K'
					gen Robust="`robust'"
					save "$datapath/004_het_results_`subsample'_`lhs'_`robust'_K`K'_LL.dta", replace
				}
			}
		}
	}			
}

